package org.nowcoder.leetcode.twoPointers;

import java.util.Arrays;

/**
 * Title  : 283. Move Zeroes
 * Source : https://leetcode.cn/problems/two-sum/
 * Author : XrazYang
 * Date   : 2023-05-31
 */
public class LeetCode_283 {
    public void moveZeroes(int[] nums) {
        if (nums.length > 1) {
            int k = 0;
            for (int i = 0; i < nums.length; i++) {
                if (nums[i] != 0 && i != k) {
                    int tmp = nums[i];
                    nums[i] = nums[k];
                    nums[k++] = tmp;
                }
            }
        }
        System.out.println(Arrays.toString(nums));
    }
}
